package com.dhp.bkOjjudgeservice.codesandbox.factory;


import com.dhp.bkOjjudgeservice.codesandbox.CodeSandBox;
import com.dhp.bkOjjudgeservice.codesandbox.impl.ExampleCodeSandBox;
import com.dhp.bkOjjudgeservice.codesandbox.impl.RemoteCodeSandBox;
import com.dhp.bkOjjudgeservice.codesandbox.impl.ThirdPartyCodeSandBox;

/**
 * 代码沙箱工厂类
 */
public class CodeSandBocFactory {

    private static final String EXAMPLE = "example";
    private static final String REMOTE = "remote";
    private static final String OTHERS = "ThirdParty";

    /**
     * 根据类型返回对应的代码沙箱
     * @param type 代码沙箱类型
     * @return 代码沙箱实例
     */
   public CodeSandBox getCodeSandBox(String type){
       if (REMOTE.equals(type)){
           return new RemoteCodeSandBox();
       }
       if (OTHERS.equals(type)){
           return new ThirdPartyCodeSandBox();
       }
       return new ExampleCodeSandBox();
   }
}
